{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from numpy import linalg as la\n",
    "import svdRec"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import *\n",
    "U,Sigma,VT=np.linalg.svd([[1, 1],[7, 7]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.14142136, -0.98994949],\n",
       "       [-0.98994949,  0.14142136]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "U"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1.00000000e+01, 2.82797782e-16])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Sigma"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.70710678, -0.70710678],\n",
       "       [ 0.70710678, -0.70710678]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "VT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([9.72140007e+00, 5.29397912e+00, 6.84226362e-01, 4.11502614e-16,\n",
       "       1.36030206e-16])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Data=svdRec.loadExData()\n",
    "U,Sigma,VT=linalg.svd(Data)\n",
    "Sigma"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[ 1.00000000e+00,  1.00000000e+00,  1.00000000e+00,\n",
       "          7.75989921e-16,  7.71587483e-16],\n",
       "        [ 2.00000000e+00,  2.00000000e+00,  2.00000000e+00,\n",
       "          3.00514919e-16,  2.77832253e-16],\n",
       "        [ 1.00000000e+00,  1.00000000e+00,  1.00000000e+00,\n",
       "          2.18975112e-16,  2.07633779e-16],\n",
       "        [ 5.00000000e+00,  5.00000000e+00,  5.00000000e+00,\n",
       "          3.00675663e-17, -1.28697294e-17],\n",
       "        [ 1.00000000e+00,  1.00000000e+00, -5.48397422e-16,\n",
       "          2.00000000e+00,  2.00000000e+00],\n",
       "        [ 3.21319929e-16,  4.43562065e-16, -3.48967188e-16,\n",
       "          3.00000000e+00,  3.00000000e+00],\n",
       "        [ 9.71445147e-17,  1.45716772e-16, -1.52655666e-16,\n",
       "          1.00000000e+00,  1.00000000e+00]])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Sig3=mat([[Sigma[0], 0, 0],[0, Sigma[1], 0], [0, 0, Sigma[2]]])\n",
    "U[:,:3]*Sig3*VT[:3,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.13367660240019172"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "myMat=np.array(svdRec.loadExData())\n",
    "svdRec.ecludSim(myMat[:,0],myMat[:,4])  # 三种距离的计算结果都和书上不一样，难道是用的数据不同？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.ecludSim(myMat[:,0],myMat[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5472455591261534"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.cosSim(myMat[:,0],myMat[:,4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9999999999999999"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.cosSim(myMat[:,0],myMat[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.23768619407595815"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.pearsSim(myMat[:,0],myMat[:,4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.pearsSim(myMat[:,0],myMat[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[4, 4, 0, 2, 2],\n",
       "       [4, 0, 0, 3, 3],\n",
       "       [4, 0, 0, 1, 1],\n",
       "       [1, 1, 1, 2, 0],\n",
       "       [2, 2, 2, 0, 0],\n",
       "       [1, 1, 1, 0, 0],\n",
       "       [5, 5, 5, 0, 0]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "myMat=np.array(svdRec.loadExData_2())\n",
    "myMat[0,1]=myMat[0,0]=myMat[1,0]=myMat[2,0]=4\n",
    "myMat[3,3]=2\n",
    "myMat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(2, 2.5), (1, 2.0243290220056256)]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.recommend(myMat, 2)  # 跟书上结果不一样，不知道哪里搞错了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(2, 3.0), (1, 2.8266504712098603)]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.recommend(myMat, 2, simMeas=svdRec.ecludSim)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(2, 2.5), (1, 2.0)]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.recommend(myMat, 2, simMeas=svdRec.pearsSim)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([15.77075346, 11.40670395, 11.03044558,  4.84639758,  3.09292055,\n",
       "        2.58097379,  1.00413543,  0.72817072,  0.43800353,  0.22082113,\n",
       "        0.07367823])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from numpy import linalg as la\n",
    "myMat = np.array(svdRec.loadExData2())\n",
    "U,Sigma,VT=la.svd(myMat)   # 从文件夹里找到的函数\n",
    "Sigma   # 跟书上不一样？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "541.9999999999995"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Sig2=Sigma**2\n",
    "sum(Sig2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "487.7999999999996"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum(Sig2)*0.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "378.8295595113579"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum(Sig2[:2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "500.5002891275793"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum(Sig2[:3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the 0 and 3 similarity is: 0.498297\n",
      "the 0 and 5 similarity is: 0.498702\n",
      "the 0 and 10 similarity is: 0.540399\n",
      "the 1 and 3 similarity is: 0.497432\n",
      "the 1 and 5 similarity is: 0.497414\n",
      "the 1 and 10 similarity is: 0.539074\n",
      "the 2 and 3 similarity is: 0.497835\n",
      "the 2 and 5 similarity is: 0.497894\n",
      "the 2 and 10 similarity is: 0.539558\n",
      "the 4 and 3 similarity is: 0.495847\n",
      "the 4 and 5 similarity is: 0.500120\n",
      "the 4 and 10 similarity is: 0.501394\n",
      "the 6 and 3 similarity is: 0.750797\n",
      "the 6 and 5 similarity is: 0.636231\n",
      "the 6 and 10 similarity is: 0.623186\n",
      "the 7 and 3 similarity is: 0.500010\n",
      "the 7 and 5 similarity is: 0.502570\n",
      "the 7 and 10 similarity is: 0.544420\n",
      "the 8 and 3 similarity is: 0.500932\n",
      "the 8 and 5 similarity is: 0.502238\n",
      "the 8 and 10 similarity is: 0.544006\n",
      "the 9 and 3 similarity is: 0.530070\n",
      "the 9 and 5 similarity is: 0.518088\n",
      "the 9 and 10 similarity is: 0.517555\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[(4, 3.334001055799355),\n",
       " (9, 3.330895617349481),\n",
       " (7, 3.3248674803258678),\n",
       " (8, 3.324616235400013),\n",
       " (0, 3.32438068443843),\n",
       " (2, 3.3243000943728127),\n",
       " (1, 3.324276526003641),\n",
       " (6, 3.3164990076214846)]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.recommend(myMat, 1, estMethod=svdRec.svdEst)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the 0 and 3 similarity is: 0.260009\n",
      "the 0 and 5 similarity is: 0.267319\n",
      "the 0 and 10 similarity is: 0.304773\n",
      "the 1 and 3 similarity is: 0.259671\n",
      "the 1 and 5 similarity is: 0.266348\n",
      "the 1 and 10 similarity is: 0.303700\n",
      "the 2 and 3 similarity is: 0.259959\n",
      "the 2 and 5 similarity is: 0.266751\n",
      "the 2 and 10 similarity is: 0.304128\n",
      "the 4 and 3 similarity is: 0.269958\n",
      "the 4 and 5 similarity is: 0.282481\n",
      "the 4 and 10 similarity is: 0.259976\n",
      "the 6 and 3 similarity is: 0.693294\n",
      "the 6 and 5 similarity is: 0.543264\n",
      "the 6 and 10 similarity is: 0.517233\n",
      "the 7 and 3 similarity is: 0.237709\n",
      "the 7 and 5 similarity is: 0.248966\n",
      "the 7 and 10 similarity is: 0.286199\n",
      "the 8 and 3 similarity is: 0.261446\n",
      "the 8 and 5 similarity is: 0.270112\n",
      "the 8 and 10 similarity is: 0.307803\n",
      "the 9 and 3 similarity is: 0.299239\n",
      "the 9 and 5 similarity is: 0.288007\n",
      "the 9 and 10 similarity is: 0.261465\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[(4, 3.3477049430350485),\n",
       " (9, 3.3393469031787215),\n",
       " (7, 3.3221301186012315),\n",
       " (8, 3.321806644564644),\n",
       " (0, 3.3212579735685965),\n",
       " (2, 3.3210621579633552),\n",
       " (1, 3.321009939503826),\n",
       " (6, 3.309765500739301)]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svdRec.recommend(myMat, 1, estMethod=svdRec.svdEst,simMeas=svdRec.pearsSim)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0. 0. 0. ... 0. 0. 0.]\n",
      " [0. 0. 0. ... 0. 0. 0.]\n",
      " [0. 0. 0. ... 0. 0. 0.]\n",
      " ...\n",
      " [0. 0. 0. ... 0. 0. 0.]\n",
      " [0. 0. 0. ... 0. 0. 0.]\n",
      " [0. 0. 0. ... 0. 0. 0.]]\n",
      "****original matrix******\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,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0,0,0,1,1,1,1,1,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "****reconstructed matrix using 2 singular values******\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n",
      "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n"
     ]
    }
   ],
   "source": [
    "svdRec.imgCompress(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
